<?php

	class EntryPointModel extends EbTableSQLModel
	{

		public function __construct()
		{
			parent::init('an_entry','Analysis/EntryPointVO','entry_id');
		}
		
		public function getColumns()
		{
			return array(
				new EbTableColumn('entry_id','INT',true,1,true),
				new EbTableColumn('referer_id','INT',true,2,false),
				new EbTableColumn('hits_id','INT',true,2,false)
			);
		}
		
		public function select($fields = null,$where = null)
		{
			$sql = 'SELECT an_referer.url AS referer,an_hits.url AS url,year,month,day,hour 
					FROM an_entry 
					INNER JOIN an_referer ON an_referer.referer_id = an_entry.referer_id 
					INNER JOIN an_hits ON an_hits.hits_id = an_entry.hits_id ';
			
			return $this->execute($sql);
		}
		
	}